<template>
  <el-image
    class="image"
    :src="wxCoreUrl"
    :preview-src-list="[wxCoreUrl]"
    style="width: 100%;height: 100%"
    fit="fit"
  />
</template>

<script>
import { getCompanyId } from '@/util/storage'
export default {
  name: 'DeviceQrcode',
  props: {
    deviceCore: {
      type: String,
      default: null
    }
  },
  data() {
    return {
      wxCoreUrl: null,
      companyId: getCompanyId()
    }
  },
  created() {
    this.show()
  },
  methods: {
    show() {
      this.wxCoreUrl =
        window.VUE_APP_BASE_API +
          '/iot/device/qrcode?deviceCore=' +
          this.deviceCore + '&companyId=' + this.companyId + '&withIcon=1'
    }
  }
}
</script>

